package com.biostime.dingdingbox.modules.db.api;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.biostime.dingdingbox.common.api.FastResponse;
import com.biostime.dingdingbox.common.api.ObjResponse;
import com.biostime.dingdingbox.common.web.BaseController;
import com.biostime.dingdingbox.modules.db.entity.Member;
import com.biostime.dingdingbox.modules.db.service.MemberService;
import com.biostime.dingdingbox.modules.sys.entity.User;


/**
 * 评论API
 * @author chenweicheng
 * @version 2016-07-01
 */
@RestController
@RequestMapping(value = "${adminPath}/db/api/video")
public class MemberApi extends BaseController {
		
	
	@Autowired
	private MemberService memberService;
	
	
	/**
	 * 注册
	 */
	@RequestMapping(value = "register")
	public ObjResponse<Map<String,Object>> play(HttpServletRequest request,HttpServletResponse response) {		
		response.setHeader("Access-Control-Allow-Origin", "*");
		String mobile = request.getParameter("mobile");
		String userId = request.getParameter("userId");
		userId = memberService.apiGetUserId(userId);
		Map<String,Object> map = new HashMap<String,Object>();
		String message = "注册成功";				
		int errCode = 0;
		if(userId != null && !userId.equals("")){
			
			Member member = new Member();
			member.setMobile(mobile);
			member.setCreateBy(new User("0"));
			member.setCreateDate(new Date());
			member.setUpdateBy(new User("0"));
			member.setUpdateDate(new Date());
			member.setLoginFlag("0");
			
		}else{
			message = "注册失败,参数不全";
			errCode = 1;
		}
				
		return  FastResponse.create().errMsg(message).errCode(errCode).obj(map);		
	}
	
		
}
